package cn.hd01.repository.entity;

import java.math.BigDecimal;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.springframework.util.StringUtils;

import cn.hd01.common.PayType;

@Entity
@Table(name = "c_order_payment")
public class PayTypeReport {
	@Id
	private Integer payType;
	
	@Transient
	private String payTypeName;
	
	private BigDecimal amount;
	
	private BigDecimal feeAmount;
	
	private BigDecimal kValue;
	
	@Transient
	private String beginDate;
	
	@Transient
	private String endDate;

	public PayTypeReport() {
		super();
		// TODO Auto-generated constructor stub
	}

	public PayTypeReport(String payTypeName,
			BigDecimal amount, BigDecimal feeAmount, BigDecimal kValue) {
		super();
		this.payTypeName = payTypeName;
		this.amount = amount;
		this.feeAmount = feeAmount;
		this.kValue = kValue;
	}

	public Integer getPayType() {
		return payType;
	}

	public void setPayType(Integer payType) {
		this.payType = payType;
	}

	public BigDecimal getAmount() {
		return amount;
	}

	public void setAmount(BigDecimal amount) {
		this.amount = amount;
	}

	public BigDecimal getFeeAmount() {
		return feeAmount;
	}

	public void setFeeAmount(BigDecimal feeAmount) {
		this.feeAmount = feeAmount;
	}

	public BigDecimal getkValue() {
		return kValue;
	}

	public void setkValue(BigDecimal kValue) {
		this.kValue = kValue;
	}

	public String getPayTypeName() {
		if(StringUtils.hasText(payTypeName)) return payTypeName;
		return PayType.getName(this.payType);
	}

	public void setPayTypeName(String payTypeName) {
		this.payTypeName = payTypeName;
	}

	public String getBeginDate() {
		return beginDate;
	}

	public void setBeginDate(String beginDate) {
		this.beginDate = beginDate;
	}

	public String getEndDate() {
		return endDate;
	}

	public void setEndDate(String endDate) {
		this.endDate = endDate;
	}
	
}
